/*
 * @Description: 
 * @Author: liyuhao
 * @Date: 2021-07-28 14:13:44
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-06-15 15:35:57
 */
import AMapLoader from '@amap/amap-jsapi-loader'
import AppConfig from "@/config";

let AMapPromise: any = null

export const loadAMap = () => {
    if (!AMapPromise) {
        AMapPromise = AMapLoader.load({
            key: AppConfig.map.key || '', // 申请好的Web端开发者Key，首次调用 load 时必填
            plugins: [],
            version: '2.0',
            AMapUI: {
                // 是否加载 AMapUI，缺省不加载
                version: '1.1', // AMapUI 缺省 1.1
                plugins: ['geo/DistrictExplorer'], // 需要加载的 AMapUI ui插件
            },
            // Loca: {
            //   // 是否加载 Loca， 缺省不加载
            //   version: '1.3.2', // Loca 版本，缺省 1.3.2
            // },
        })
    }
    return AMapPromise
}